home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6167 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: port-1-5.access.one.net!oren
  2. From: Oren Levin <oren@one.net>
  3. Newsgroups: comp.lang.c
  4. Subject: HELP: Illegal Pointer Arithmetic
  5. Date: 23 Feb 1996 00:15:12 GMT
  6. Organization: OneNet Communications HUB News Server
  7. Distribution: world
  8. Message-ID: <4gj0ug$730@news.one.net>
  9. NNTP-Posting-Host: port-1-5.access.one.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: Nuntius 2.0.4_68K
  14. X-XXMessage-ID: <AD527149A301C10F@port-1-5.access.one.net>
  15. X-XXDate: Thu, 22 Feb 1996 00:15:21 GMT
  16.  
  17. I was wondering if someone could help me. I'm in the midst of learning
  18. C/C++ and am trying to program the examples in Andrew Birnstock and John
  19. Rex's book "Practical Algorithyms for Programers." I am using Symentec's
  20. Think C++ (v 6 - Mac).
  21. The following code is giving me a "illegal pointer arithmetic" error.
  22. I'm trying to strip the carrage return off of a line of text read from a
  23. file.
  24.  
  25. TIA for the help.
  26. Oren Levin
  27. oren@one.net
  28.  
  29. === code snippet ===
  30.         while (! feof (fin))
  31.         {
  32.             /* read a record */
  33.             if (fgets (buffer, 127, fin) == NULL)
  34.                 break;
  35.             
  36.             /* get rid of the trailing carrage return */
  37.             buffer [strlen (buffer) - 1] = "\0";
  38.